trigger CampaignMemberCallsIncrement on Task (after insert, after update){

//Declare a set to capture all the ID's of the Campaign Members.
     set<Id> Campid = new Set<Id>(); 
     List<CXG_Campaign_Accounts__c> CxG = New List<CXG_Campaign_Accounts__c>();          
       
     //Capture all the ID's of the Campaign Members related to the associated task.
     for(Task tsk :Trigger.New)
         {
                campid.add(tsk.whatId); 
                system.debug('Camp Set has : '+campid);
         }
     
     //Declare a Map and update it with the ID of the Campaign Member
     Map<Id,CXG_Campaign_Accounts__c> CampStatus = New Map<ID,CXG_Campaign_Accounts__c>();
          
     for(CXG_Campaign_Accounts__c ctr:[Select Id,Number_of_Call_Attempts_Made__c from CXG_Campaign_Accounts__c where Id IN: Campid]) 
         { 
              CampStatus.put(ctr.id,ctr);                   
         }
     
      /*-------------------------------------------------------------------------------------------------*/    
     List<Id> Campmember = New List<Id>();

     for(Task tsk:trigger.New)
         {
         system.debug('Inside TASK Trigger');
         if(Tsk.Disposition__c=='Called Customer - Left Msg'||Tsk.Disposition__c=='Attempt Made')
             {
                    Campmember.add(tsk.whatid)    ;
             }
         }
     for(CXG_Campaign_Accounts__c Calls:[Select Number_of_Call_Attempts_Made__c from CXG_Campaign_Accounts__c where id in:Campmember])
         {    
                    Calls.Number_of_Call_Attempts_Made__c+= 1;
                    CxG.add(Calls);
         } 
      
     try
     {    
         Update CxG;   
     }
     Catch(DMLexception e)
     {
         System.debug(e);
     }
}